package com.urea.system.service.impl;

import java.time.LocalDateTime;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.urea.system.mapper.RechargePackageMapper;
import com.urea.system.domain.RechargePackage;
import com.urea.system.service.IRechargePackageService;

/**
 * 充值套餐Service业务层处理
 * 
 * @author liuzd
 * @date 2023-08-01
 */
@Service
public class RechargePackageServiceImpl extends ServiceImpl<RechargePackageMapper, RechargePackage> implements IRechargePackageService
{
    @Autowired
    private RechargePackageMapper rechargePackageMapper;

    /**
     * 查询充值套餐
     * 
     * @param id 充值套餐主键
     * @return 充值套餐
     */
    @Override
    public RechargePackage selectRechargePackageById(Long id)
    {
        return rechargePackageMapper.selectRechargePackageById(id);
    }

    /**
     * 查询充值套餐列表
     * 
     * @param rechargePackage 充值套餐
     * @return 充值套餐
     */
    @Override
    public List<RechargePackage> selectRechargePackageList(RechargePackage rechargePackage)
    {
        return rechargePackageMapper.selectRechargePackageList(rechargePackage);
    }

    /**
     * 新增充值套餐
     * 
     * @param rechargePackage 充值套餐
     * @return 结果
     */
    @Override
    public int insertRechargePackage(RechargePackage rechargePackage)
    {
        return this.save(rechargePackage)?1:0;
//        return rechargePackageMapper.insertRechargePackage(rechargePackage);
    }

    /**
     * 修改充值套餐
     * 
     * @param rechargePackage 充值套餐
     * @return 结果
     */
    @Override
    public int updateRechargePackage(RechargePackage rechargePackage)
    {
        rechargePackage.setUpdatedTime(LocalDateTime.now());
        return rechargePackageMapper.updateRechargePackage(rechargePackage);
    }

    /**
     * 批量删除充值套餐
     * 
     * @param ids 需要删除的充值套餐主键
     * @return 结果
     */
    @Override
    public int deleteRechargePackageByIds(Long[] ids)
    {
        return rechargePackageMapper.deleteRechargePackageByIds(ids);
    }

    /**
     * 删除充值套餐信息
     * 
     * @param id 充值套餐主键
     * @return 结果
     */
    @Override
    public int deleteRechargePackageById(Long id)
    {
        return rechargePackageMapper.deleteRechargePackageById(id);
    }
}
